package com.bs.resa.web;

import com.bs.resa.service.LogService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author lin
 * @date 2019/4/2 21:33
 */
@RestController
public class LogController {
    protected Map<String, Object> resultMap = new LinkedHashMap<String, Object>();


    @Autowired
    LogService logService;

    @ResponseBody
    @ApiOperation(value = "获得项目日志",notes = "POST")
    @RequestMapping(value="project/queryLog/{pid}.do",method= RequestMethod.POST)
    public Object queryLog(@PathVariable("pid") String pid){
       try {
           List<Map<String,Object>> logs=logService.queryLogByPid(pid);
           resultMap.put("code",200);
           resultMap.put("message","查询日志成功");
           resultMap.put("data",logs);
       }catch (Exception e){
           resultMap.put("code",500);
           resultMap.put("message","查询日志失败！");
           resultMap.put("data",e.getMessage());

       }
        return  resultMap;
    }

}
